package com.kc.data.common.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.kc.data.common.base.StringUtils;
import com.kc.data.common.domain.model.BizShipping;
import com.kc.data.common.mapper.BizShippingMapper;
import com.kc.data.common.service.IBizShippingService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class BizShippingServiceImpl implements IBizShippingService {
    @Resource
    BizShippingMapper shippingMapper;
    /**
     * 查询物流列表
     *
     * @param bizShipping
     * @return
     */
    @Override
    public List<BizShipping> getList(BizShipping bizShipping) {
        LambdaQueryWrapper<BizShipping> wrapper = new LambdaQueryWrapper<>();
        if(StringUtils.isNotEmpty(bizShipping.getCode())){
            wrapper.eq(BizShipping::getCode,bizShipping.getCode());
        }
        return shippingMapper.selectList(wrapper);
    }

    /**
     * 新增物流
     *
     * @param bizShipping
     * @return
     */
    @Override
    public int add(BizShipping bizShipping) {
        return shippingMapper.insert(bizShipping);
    }

    /**
     * 修改物流
     *
     * @param bizShipping
     * @return
     */
    @Override
    public int edit(BizShipping bizShipping) {
        return shippingMapper.updateById(bizShipping);
    }
}
